<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-propertyConstraint-add">
			<input name="beanName"  type="hidden"  id="lookupId"/>
			<div class="form-group">
				<label class="col-sm-3 control-label">名称：</label>
				<div class="col-sm-8">
					<input id="name" name="name" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">描述：</label>
				<div class="col-sm-8">
					<input id="description" name="description" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">约束验证类Bean名称：</label>
				<div class="col-sm-8">
					<!--<input id="beanName" name="beanName" class="form-control" type="text">-->
					<input id="lookupName"   name="onlyValidateNoSave"  onclick="selectPropConstraintBeanList()"  class="form-control" type="text" readonly>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">约束验证使用的参数值：</label>
				<div class="col-sm-8">
					<!--<input id="beanParameter" name="beanParameter" class="form-control" type="text">-->
					<textarea  id="beanParameter" name="beanParameter" class="form-control"  rows="3" cols="20"></textarea>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<!--<input id="remark" name="remark" class="form-control" type="text">-->
					<textarea  id="remark" name="remark" class="form-control"  rows="3" cols="20"></textarea>
				</div>
			</div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "module/propertyConstraint"
		$("#form-propertyConstraint-add").validate({
			rules:{
				name:{
					required:true,
				},
                description:{
                    required:true,
                },
                beanName:{
                    required:true,
                },
                onlyValidateNoSave:{
                    required:true,
                },
			},
			submitHandler: function(form) {
				$.operate.save(prefix + "/add", $('#form-propertyConstraint-add').serialize());
			}
		});
        /*选择属性约束列表*/
        function selectPropConstraintBeanList() {
            var lookupId = $("#lookupId").val();
            if(lookupId == ""||lookupId==undefined){
                lookupId="";
            }

            var url = ctx + "module/propertyConstraintBean/lookupList?lookupId="+lookupId;
            var options = {
                title: '约束验证类Bean名称',
                width: "780",
                height: "380",
                url: url,
                callBack: function(index, layero){
                    var body = layer.getChildFrame('body', index);
                    $("#lookupId").val(body.find('#lookupId').val());
                    $("#lookupName").val(body.find('#lookupName').val());
                    layer.close(index);
                }
            };
            $.modal.openOptions(options);
        }
	</script>
</body>
</html>
